package cn.sciento.starter.tenant.custom.configuration;

import cn.sciento.starter.tenant.custom.core.TenantCustomRequestMappingHandlerMapping;
import cn.sciento.starter.tenant.custom.repository.TenantCustomPointRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.web.servlet.WebMvcRegistrations;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.annotation.Order;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping;

@Configuration
@Order(-2147483648)
public class TenantCustomWebConfiguration implements WebMvcConfigurer, WebMvcRegistrations {
  @Autowired
  private TenantCustomPointRepository tenantCustomPointRepository;
  
  @Value("${spring.application.name}")
  private String serviceName;
  
  public RequestMappingHandlerMapping getRequestMappingHandlerMapping() {
    return new TenantCustomRequestMappingHandlerMapping(this.tenantCustomPointRepository, this.serviceName);
  }
}
